# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-blockdiag
_pkgname=blockdiag
pkgver=3.0.0
pkgrel=5
pkgdesc="Generate block-diagram image file from spec-text file"
url="http://blockdiag.com"
arch="noarch"
license="Apache-2.0"
depends="py3-funcparserlib py3-pillow py3-webcolors"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
checkdepends="py3-docutils py3-nose py3-pytest"
subpackages="$pkgname-tests $pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	0001-Add-support-for-Pillow-10.patch"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-blockdiag"                  # for backwards compatibility
provides="py-blockdiag=$pkgver-r$pkgrel" # for backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest --pyargs blockdiag
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

tests() {
	amove usr/lib/python3*/site-packages/blockdiag/tests
}

sha512sums="
e0e588941c5212a924068cc0b3953b670089e33c385ea8ce52fc54f5ca79414fb12217eba1052c5384c9f2fd81e79304639c9604cdc4a6464f7c221bb67ef267  blockdiag-3.0.0.tar.gz
d4df096a925ace1cda6e8c8430244e1da39cc03ed04366f8e206568491d7ada2671b7583d3209263ab0d5a00eae7091abe00592e8c2789db40fd8c10bb259705  0001-Add-support-for-Pillow-10.patch
"
